package com.ruoyi.web.controller.review;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.discuss.domain.SysDiscuss;
import com.ruoyi.discuss.service.IDiscussService;
import com.ruoyi.discuss.vo.DiscussVO;
import com.ruoyi.discuss.vo.TreeDiscussVO;
import com.ruoyi.review.domain.SysInterflow;
import com.ruoyi.review.service.ISysInterflowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 问答Controller
 * 
 * @author YJF
 * @date 2023-05-08
 */
@RestController
@RequestMapping("/review/discuss")
public class SysDiscussController extends BaseController
{
    @Autowired
    private IDiscussService discussService;


    /**
     * 查询考核列表
     */
    @PreAuthorize("@ss.hasPermi('review:discuss:list')")
    @GetMapping("/list")
    public TableDataInfo list(TreeDiscussVO discuss) {
        startPage();
        discuss.setParentDiscussId(0L);
        List<TreeDiscussVO> list = discussService.listSysDiscuss(discuss);
        return getDataTable(list);
    }

    /**
     * 查询考核列表
     */
    @PreAuthorize("@ss.hasPermi('review:discuss:reply')")
    @GetMapping("/reply")
    public AjaxResult reply(TreeDiscussVO discuss) {
        startPage();
        List<TreeDiscussVO> list = discussService.listSysReply(discuss.getParentDiscussId());
        return AjaxResult.success(list);
    }

    /**
     * 查询考核列表
     */
    @PreAuthorize("@ss.hasPermi('review:discuss:remove')")
    @PostMapping("/del")
    public AjaxResult del( @RequestBody TreeDiscussVO discuss) {
        discussService.delDiscuss(discuss.getDiscussId());
        return AjaxResult.success();
    }

}
